<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>乐淘-朱文勇</title>
  <link rel="stylesheet" href="./lib/bootstrap/css/bootstrap.css">
  <link rel="stylesheet" href="./lib/bootstrap-validator/css/bootstrapValidator.css">
  <link rel="stylesheet" href="./lib/nprogress/nprogress.css">
  <link rel="stylesheet" href="./css/common.css">

</head>

<body class="pt-180 ts-pt">
  <!-- 侧边栏 -->
  <div class="lt-aside">
    <h3><a href="#">黑马商城</a></h3>
    <div class="info">
      <img src="../admin/images/default.png" alt="">
    </div>
    <p>超级管理员</p>
    <ul>
      <li>
        <a href="user.html">
          <i class="glyphicon glyphicon-user"></i>
          <span>用户管理</span>
        </a>
      </li>
      <li>
        <a href="#" class="cate-link">
          <i class="glyphicon glyphicon-th-list"></i>
          <span>分类管理</span>
        </a>
        <div class="my-hide cate-list">
          <a href="one.html" class="pl-20">一级分类</a>
          <a href="two.html" class="pl-20">二级分类</a>
        </div>
      </li>
      <li class="current">
        <a href="product.html">
          <i class="glyphicon glyphicon-tags"></i>
          <span>商品管理</span>
        </a>
      </li>
    </ul>
  </div>

  <!-- 主体 -->
  <div class="lt-main">
    <!-- 头部 -->
    <div class="lt-top pt-180 ts-pt">
      <a href="#" class="menu pull-left">
        <i class="glyphicon glyphicon-align-justify"></i>
      </a>
      <a href="login.html" class="out pull-right">
        <i class="glyphicon glyphicon-log-out"></i>
      </a>
    </div>
    <!-- 内容 -->
    <div class="content">
      <!-- 路径导航 -->
      <ol class="breadcrumb">
        <li><a href="index.html">管理系统</a></li>
        <li class="active">商品管理</li>
      </ol>
      <!-- 添加分类按钮 -->
      <button type="button" class="btn btn-default" data-toggle="modal" data-target=".product-modal">添加商品</button>

      <!-- 表格 -->
      <table class="table table-bordered table-hover text-center mt-20">
        <thead>
          <tr>
            <th>序号</th>
            <th>商品名称</th>
            <th>商品描述</th>
            <th>商品库存</th>
            <th>商品尺寸</th>
            <th>商品状态</th>
            <th>操作</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td>序号</td>
            <td>商品名称</td>
            <td>商品描述</td>
            <td>商品库存</td>
            <td>商品尺寸</td>
            <td>商品状态</td>
            <td>
              <button class="btn btn-danger" data-toggle="modal" data-target=".modal-product">下架</button>
            </td>
          </tr>
        </tbody>
      </table>

      <!-- 分页父容器 -->
      <div class="pull-right">
        <ul id="paginator"></ul>
      </div>
    </div>
  </div>

  <!-- 模态框 -->
  <div class="modal fade product-modal" tabindex="-1" role="dialog">
    <div class="modal-dialog" role="document">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
              aria-hidden="true">&times;</span></button>
          <h4 class="modal-title">添加二级分类</h4>
        </div>

        <div class="modal-body">
          <form class="add-form" id="form1">
            <!-- 下拉列表 -->
            <div class="form-group">
              <div class="dropdown">
                <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown"
                  aria-haspopup="true" aria-expanded="true">
                  <span class="product-span">请选择二级分类</span>
                  <span class="caret"></span>
                </button>
                <ul class="dropdown-menu add-pro-list" aria-labelledby="dropdownMenu1">
                  <li><a href="#">Action</a></li>
                </ul>
              </div>
              <!-- 隐藏域 用来向后台提交数据 -->
              <input type="hidden" name="brandId" id="brandId">
            </div>

            <!-- 输入框 要放在表单组里面 -->
            <!-- 商品名称 -->
            <div class="form-group mt-20">
              <input type="text" class="form-control" placeholder="请输入商品名称" name="proName" id="proName">
            </div>
            <!-- 商品描述 -->
            <div class="form-group mt-20">
              <textarea name="proDesc" id="proDesc" class="form-control" placeholder="请输入商品描述"></textarea>
            </div>
            <!-- 商品库存 -->
            <div class="form-group mt-20">
              <input type="text" class="form-control" placeholder="请输入商品库存" name="num" id="num">
            </div>
            <!-- 商品尺码 -->
            <div class="form-group mt-20">
              <input type="text" class="form-control" placeholder="请输入商品尺码" name="size" id="size">
            </div>
            <!-- 商品原价 -->
            <div class="form-group mt-20">
              <input type="text" class="form-control" placeholder="请输入商品原价" name="oldPrice" id="oldPrice">
            </div>
            <!-- 商品现价 -->
            <div class="form-group mt-20">
              <input type="text" class="form-control" placeholder="请输入商品现价" name="price" id="price">
            </div>

            <!-- 图片上传 -->
            <div class="form-group">
              <label for="file" class="btn btn-default">图片上传</label>
              <!-- name指定图片上传时的name属性 -->
              <!-- data-url指定图片上传时的接口地址 -->
              <!-- multiple指定多文件上传 -->
              <input type="file" id="file" class="hide" name="pic1" data-url="/product/addProductPic" multiple>
              <br>
              <!-- 图片容器 -->
              <div class="img-box mt-20"></div>
              <!-- 隐藏域 用来存放图片的地址 -->
              <input type="hidden" name="picArr" id="picArr">
            </div>
          </form>
        </div>

        <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
          <button type="submit" class="btn btn-primary" form="form1">添加</button>
        </div>
      </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
  </div><!-- /.modal -->

  <!-- 首页渲染数据模板引擎 -->
  <script type="text/html" id="tmp">
  {{ each rows v i }}
  <tr>
    <td>{{ (page-1)*size + i + 1 }}</td>
    <td>{{ v.proName }}</td>
    <td>{{ v.proDesc }}</td>
    <td>{{ v.num }}</td>
    <td>{{ v.size }}</td>
    <td>{{ v.statu == 1 ? '已上架':'已下架' }}</td>
    <td data-id = {{ v.id }}>
      {{ if v.statu == 1}}
      <button class="btn btn-danger">下架</button>
      {{ else }}
      <button class="btn btn-success">上架</button>
      {{ /if }}
    </td>
  </tr>
  {{ /each }}
  </script>

  <!-- 二级分类下拉列表数据模板 -->
  <script type="text/html" id="tmp-pro">
    {{ each rows v i }}
       <li><a href="#" data-id = {{ v.id }}>{{ v.brandName }}</a></li>
    {{ /each }}
  </script>

  <script src="./lib/artTemplate/template-web.js"></script>
  <script src="./lib/jquery/jquery.js"></script>
  <script src="./lib/bootstrap/js/bootstrap.js"></script>
  <script src="./lib/bootstrap-validator/js/bootstrapValidator.js"></script>
  <script src="./lib/nprogress/nprogress.js"></script>
  <script src="./lib/bootstrap-paginator/bootstrap-paginator.js"></script>
  <script src="./lib/jquery-fileupload/jquery.ui.widget.js"></script>
  <script src="./lib/jquery-fileupload/jquery.iframe-transport.js"></script>
  <script src="./lib/jquery-fileupload/jquery.fileupload.js"></script>
  <script src="./js/common.js"></script>
  <script src="./js/product.js"></script>
</body>

</html>